from __future__ import annotations

from dataclasses import dataclass
from math import pi


@dataclass
class LayingForce:
    pulling_tension_kN: float
    sidewall_pressure_kPa: float
    note: str


def calculate_pulling_tension(
    cable_weight_kN_m: float,
    friction_coeff: float,
    length_m: float,
    bend_angles_deg: float = 0.0,
    blow_factor: float = 1.1,
) -> LayingForce:
    """电缆牵引张力与侧壁压力估算。

    - 直线段：T ≈ w·L·μ·系数
    - 弯段：乘以 e^(μ·θ)
    - 侧壁压力：P ≈ T·μ / R （此处仅给趋势，未显式含R）
    """

    base = cable_weight_kN_m * length_m * friction_coeff * blow_factor
    import math
    theta = bend_angles_deg * pi / 180.0
    T = base * math.exp(friction_coeff * theta)
    P = T * friction_coeff  # 简化
    return LayingForce(pulling_tension_kN=T, sidewall_pressure_kPa=P, note="需结合弯曲半径复核侧压")


